<!DOCTYPE html>
<html lang="en">
<head>
    <!--
    @Author 硕鼠
    @Date 2020/4/7 9:21
    @Version 1.0
    @Description switch使用
  -->
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        var name = 'abc';
        var sex = '男';
        switch (sex){
            case "男":
                alert(name + '先生，您好');
                break;
            case "女":
                alert(name + '女士，您好');
                break;
            default:
                alert(name + '您好');
                break;
        }
    </script>
</head>
<body>


</body>
</html>